Module word completion for the eric-ide shell.
This version is a re-implementation of _module_completer as found in the Python3 library. It is modified to work with the eric-ide debug client.
| None |
| ImportParser | Class to Parse incomplete import statements that are suitable for autocomplete suggestions. |
| ModuleCompleter | Class implementing a completer for Python import statements. |
| ParseError | Class representing a parsing issue. |
| Result | Class implementing the result data structure. |
| TokenQueue | Class implementing helper functions for working with a sequence of tokens. |
| None |
Class to Parse incomplete import statements that are suitable for autocomplete suggestions.
Examples: - import foo -> Result(from_name=None, name='foo') - import foo. -> Result(from_name=None, name='foo.') - from foo -> Result(from_name='foo', name=None) - from foo import bar -> Result(from_name='foo', name='bar') - from .foo import ( -> Result(from_name='.foo', name='')
Note that the parser works in reverse order, starting from the last token in the input string. This makes the parser more robust when parsing multiple statements.
| _ignored_tokens |
| _keywords |
| None |
| ImportParser | Constructor |
| _parse | Protected method parse the supported import variants. |
| parse | Public method to parse the code line. |
| parse_as_name | Public method to parse the as part. |
| parse_as_names | Public method to parse the as parts. |
| parse_dotted_as_name | Public method to parse a dotted as name. |
| parse_dotted_name | Public method to parse a dotted name. |
| parse_empty_from_import | Public method to parse an empty from...import statement. |
| parse_from | Public method to parse the from part. |
| parse_from_import | Public method to parse a from...import statement. |
| parse_import | Public method to parse a simple import statement. |
| None |
Constructor
Protected method parse the supported import variants.
Public method to parse the code line.
Public method to parse the as part.
Public method to parse the as parts.
Public method to parse a dotted as name.
Public method to parse a dotted name.
Public method to parse an empty from...import statement.
Public method to parse the from part.
Public method to parse a from...import statement.
Public method to parse a simple import statement.
Class implementing a completer for Python import statements.
Examples:
- import
- from
| None |
| None |
| ModuleCompleter | Constructor |
| _find_modules | Protected method to find all modules under 'path' that start with 'prefix' (even invalid module names). |
| complete | Public method to complete module or submodule names. |
| find_modules | Public method to find all modules under 'path' that start with 'prefix'. |
| format_completion | Public method to format a valid module path. |
| get_completions | Public method to get the next possible import completions for 'line'. |
| get_path_and_prefix | Public method to split a dotted name into an import path and a final prefix that is to be completed. |
| global_cache | Public method implementing the global module cache. |
| is_suggestion_match | Public method to ckeck, if 'module_name' is a valid suggestion. |
| iter_submodules | Public method to iterate over all submodules of the given parent modules. |
| resolve_relative_name | Public method to resolve a relative module name to an absolute name. |
| None |
Constructor
Protected method to find all modules under 'path' that start with 'prefix' (even invalid module names).
Public method to complete module or submodule names.
Public method to find all modules under 'path' that start with 'prefix'.
Public method to format a valid module path.
Public method to get the next possible import completions for 'line'.
Public method to split a dotted name into an import path and a final prefix that is to be completed.
Examples: 'foo.bar' -> 'foo', 'bar' 'foo.' -> 'foo', '' '.foo' -> '.', 'foo'
Public method implementing the global module cache.
Public method to ckeck, if 'module_name' is a valid suggestion.
Public method to iterate over all submodules of the given parent modules.
Public method to resolve a relative module name to an absolute name.
Example: resolve_relative_name('.foo', 'bar') -> 'bar.foo'
Class representing a parsing issue.
| None |
| None |
| None |
| None |
Class implementing the result data structure.
| from_name |
| name |
| None |
| None |
| None |
Class implementing helper functions for working with a sequence of tokens.
| None |
| None |
| TokenQueue | Constructor |
| __bool__ | Special method implementing the 'bool' logic. |
| peek | Public method to get the next token without popping it. |
| peek_name | Public method to check, if the next token is a name token without popping it. |
| peek_string | Public method check, if the next token has a specific value. |
| pop | Public method to pop the next token off the stack. |
| pop_name | Public method to pop a name token off the token stack. |
| pop_string | Public method to pop the next token and return its value, if it is of a specific name. |
| save_state | Public method implementing a context manager to save the current state. |
| None |
Constructor
Special method implementing the 'bool' logic.
Public method to get the next token without popping it.
Public method to check, if the next token is a name token without popping it.
Public method check, if the next token has a specific value.
Public method to pop the next token off the stack.
Public method to pop a name token off the token stack.
Public method to pop the next token and return its value, if it is of a specific name.
Public method implementing a context manager to save the current state.